<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    const message = 'abc.why'

    const re = /./ig
    console.log(message.match(re))  // ['a', 'b', 'c', '.', 'w', 'h', 'y']

    const re1 = /\./ig
    console.log(message.match(re1)) // ['.']

    // 需要转义的字符
    // [] \ ^ $ . | ? * + ( ) 

    const fileNames = ['abc.html', 'Home.jsx', 'index.html', 'index.js', 'util.js', 'format.js']
    // 获取所有js的文件名
    const jsFileNames = fileNames.filter(name => /\.jsx?$/.test(name))
    console.log(jsFileNames) // ['Home.jsx', 'index.js', 'util.js', 'format.js']

  </script>
</body>

</html>